﻿namespace WriterStars.Data.Repository
{
    using System;
    using System.Linq;
    using WriterStars.Model;

    public class BooksRepository : GenericRepository<Book>, IBooksRepository
    {
        public BooksRepository()
            : base(new WriterStarsDbContext())
        {
        }

        public BooksRepository(IWriterStarsDbContext context)
            : base(context)
        {
        }

        public IQueryable<Book> GetByAuthorId(int authorId)
        {
            return this.db.Books.Where(x => x.AuthorId == authorId);
        }
    }
}